﻿using System.Collections.Generic;
using System.Windows.Media;

namespace Bookvar.Common
{
    /// <summary>
    /// This class represents a queue with contrast colors.
    /// </summary>
    public sealed class ColorsSequence
    {
        private readonly Queue<Color> userColors;

        /// <summary>
		/// Initializes a new instance of the <see cref="ColorsSequence"/> class.
        /// </summary>
        public ColorsSequence()
        {
            userColors = new Queue<Color>(10);
            userColors.Enqueue(Colors.Red);
            userColors.Enqueue(Colors.Green);
            userColors.Enqueue(Colors.Olive);
            userColors.Enqueue(Colors.Pink);
            userColors.Enqueue(Colors.Brown);
            userColors.Enqueue(Colors.Violet);
            userColors.Enqueue(Colors.Orange);
            userColors.Enqueue(Colors.Turquoise);
            userColors.Enqueue(Colors.Indigo);
            userColors.Enqueue(Colors.Navy);
        }

        /// <summary>
        /// Gets the color. The queue contains 10 colors. 
        /// If more are used Color.Black is returned.
        /// </summary>
        /// <returns>A color.</returns>
        public Color DequeueColor()
        {
            if(userColors.Count <= 0)
            {
                return Colors.Black;
            }
            return userColors.Dequeue();
        }

        /// <summary>
        /// Returns the color ot the queue.
        /// </summary>
        /// <param name="color">The color.</param>
        public void EnqueueColor(Color color)
        {
            userColors.Enqueue(color);
        }
    }
}